program ROLLINGDISPLAY;
{$U+}
 var
       temp,str : string[80];
   W,Z,X,Y,X1,I : INTEGER;
        CHR,CHA : CHAR;

procedure ROLLX;
 begin
   Z := 1;
   repeat
     X:=80;
     Y:=12;
     X1:=1;
     for I:=1 to 80 do
       temp:=' ';
     for I:=1 to length(str) do
       begin
         gotoxy(X,Y);
         insert(str[i],temp,x1);
         write(temp);
         clreol ;
         delay(150);
         x:=x-1;
         X1:=X1+1;
       end;
     y:=12;
     while( x <> 1) do
      begin
        gotoxy(x,y);
        write(TEMP);
        clreol ;
        delay(150);
        x:=x-1;
      end;
      I:=1;
      while (I <= length(str))do
       begin
         gotoxy(1,12);
         delete(TEMP,1,1);
         write(temp);
         clreol ;
         delay(150);
         I:=I+1;
       end;
     Z := Z + 1;
   until ( Z > W);
 end;

begin
  clrscr;
  WRITELN('                  ROLLING             DISPLAY   ');
  WRITELN;WRITELN;
  WRITELN;
  WRITELN;
  WRITE('ENTER THE STRING >>  ');
  readln(str);
  WRITELN;
  WRITELN;
  WRITE('ENTER THE NO. OF TIMES YOU WANT TO SCROLL  >>  ');
  READLN(W);
  clrscr;
  rollx;
end.
